package com.mach.platform.repository;

import com.mach.platform.domain.iot.IotCollItem;
import com.mach.platform.domain.iot.IotDev;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author Anonymous
 * @Description: 设备数据项
 * @Package: com.mach.platform.repository
 * @time 2018/04/27 23:12
 */
@Repository
public interface IotCollItemRepo extends BaseRepository<IotCollItem>{

    /**
     * 查询真实设备的属性
     * @param id
     * @return
     */
    @Query(value = "select name from iot_coll_items where dev_type_id = (select dev_type_id from iot_dev where id = ?1)", nativeQuery = true)
    List<String> findIotDevItems(Long id);

    /**
     * 查询母线设备类型的全部属性
     * @return
     */
    @Query(value = "select name from iot_coll_items where dev_type_id = 106", nativeQuery = true)
    List<String> findNamesByDevTypeId();

}
